# coding: utf-8
from application import db


class UserInfo(db.Model):
    __tablename__ = 'user_info'

    id = db.Column(db.Integer, primary_key=True)
    nickname = db.Column(db.String(30))
    updated_time = db.Column(db.DateTime, nullable=False)
    created_time = db.Column(db.DateTime, nullable=False)
    login_id = db.Column(db.ForeignKey('user.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False, index=True)

    login = db.relationship('User', primaryjoin='UserInfo.login_id == User.id', backref='user_infos')
